package io;

import java.io.*;
import java.util.Scanner;

public class PWDemo2 {
    public static void main(String[] args) throws FileNotFoundException {
        FileOutputStream fos = new FileOutputStream("pw.txt");
        OutputStreamWriter osw = new OutputStreamWriter(fos);
        BufferedWriter bw = new BufferedWriter(osw);
        PrintWriter pw = new PrintWriter(bw,true);
        Scanner scan = new Scanner(System.in);
        System.out.println("请开始输入内容，exit退出输入");
        while (true){
            String s = scan.nextLine();
            if ("exit".equals(s)) {
                System.out.println("输入结束");
                break;
            }
            pw.println(s);
        }
        pw.close();
    }
}
